Re: Linux/SATAN

Josh Wilmes (wilmesj@rpi.edu)
Fri, 07 Apr 1995 10:11:50 +22295807

> On Wed, 5 Apr 1995, Adam Machanic wrote:
> 
> >   I've been trying to compile Satan on my Linux box here, but I'm not having
> > too much success.. Any help would be appreciated.. I'm getting an error
> > from rex.c.
> > 
> > 
> > 			Adam Machanic
> > 				-- amachani@gwhs.denver.k12.co.us
> 


Here's a set of patches by someone here at RPI.. I have not tested them, and 
make no guarantees, but apparently, they work..

>From rpi!marcus.its.rpi.edu!lohnen Fri Apr  7 10:09:51 1995
Path: rpi!marcus.its.rpi.edu!lohnen
From: lohnen@marcus.its.rpi.edu (Nils Lohner)
Newsgroups: rpi.os.linux,rpi.talk.linux
Subject: SATAN: Linux Port/Hack
Date: 5 Apr 1995 17:45:31 GMT
Organization: its
Lines: 210
Message-ID: <3lukvr$aks@usenet.rpi.edu>
NNTP-Posting-Host: marcus.its.rpi.edu
X-Newsreader: TIN [version 1.2 PL2]
Xref: rpi rpi.os.linux:272 rpi.talk.linux:68


Linux port for SATAN
by Nils Lohner
lohnen@rpi.edu

  This is less of a port and more of a quick hack to make it compile properly.
I am not guaranteeing anything except that it compiles on my linux box.  I
am corrently running verion 1.2.0 of th kernel.

  It did successfully scan etc. and find vulnerabilities, so I am assuming
that these fixes do make it work successfully.

WHAT TO DO:

- delete the first 6 lines from ./reconfig
	- REASON: sh doesn't like them

- run reconfig by typing
'perl reconfig'


SATAN will now cofigure itself if you have perl5 or higher installed
successfully.

- make a new header file 
'satan-1.0/include/netinet/ip_icmp_lin.h'

- include this header file in the following three files:
#include "../../include/netinet/ip_icmp_lin.h"

src/port_scan/tcp_scan.c
src/port_scan/udp_scan.c
src/fping/fping.c

NOTE: do NOT comment out the existing include line!!  Here, the existing
      header file is being supplemented and not replaced!

  This header file does several things:
	- it defines ICMP_MINLEN
	- it fixes a few ICMP name incompatibilities
	- it makes the proper 'struct ip' as needed by SATAN
		- note: check the endianness in the file if it it not
			little endian!!!
	- it makes the proper 'struct icmp' as needed by SATAN




- make a new header file 
'satan-1.0/include/netinet/udp_lin.h'

- include this header file in the following file:
#include "../../include/netinet/udp_lin.h"

src/port_scan/udp_scan.c

NOTE: IN this case _DO_ comment out the current line, or you will get 
      udphdr redefined.  In this case the header file is being replaced,
      and not supplemented as before.
	#include <netinet/udp.h> 

- now do a 'make linux' from the satan-1.0 directory.
- it will bomb out in the src/misc directory
- go to the src/misc directory and simply type 'make'
- now it will make
- go back up to the satan-1.0 dir and do a 'make linux' again

- it will bomb out in the src/nfs-chk directory
- go to the src/nfs-chk directory and simply type 'make'
- now it will make
- go back up to the satan-1.0 dir and do a 'make linux' again

  It will finish compiling.

set dont_use_nslookup=1 if it asks you to set dont-use_dns.


Now go ahead and scan!  Please use this tool reasonably...

                          Nils Lohner
                          lohnen@rpi.edu


--- cut here for file include/netinet/ip_icmp_lin.h --------------------------
/*  this value was taken from ip_icmp.h fom an RS-6000 */
#define ICMP_MINLEN           8

/* all of these exist, just under a different name */

#define ICMP_UNREACH          ICMP_DEST_UNREACH
#define ICMP_UNREACH_NET      ICMP_NET_UNREACH
#define ICMP_UNREACH_PROTOCOL ICMP_PROT_UNREACH
#define ICMP_UNREACH_PORT     ICMP_PORT_UNREACH
#define ICMP_UNREACH_HOST     ICMP_HOST_UNREACH

/* this structure was taken from an RS-6000 */
/* ip_v and ip_hl are defined elsewhere as well, but necessary here */
struct ip {
#if __BYTE_ORDER == __LITTLE_ENDIAN
        unsigned        ip_hl:4,                /* header length */
                ip_v:4;                 /* version */
#endif

/*#if __BYTE_ORDER == __BIG_ENDIAN*/
/*        unsigned        ip_v:4, */              /* version */
/*                ip_hl:4; */             /* header length */
/*#endif*/

        u_char  ip_tos;                 /* type of service */
        u_short ip_len;                 /* total length */
        u_short ip_id;                  /* identification */
        u_short ip_off;                 /* fragment offset field */
#define IP_DF 0x4000                    /* dont fragment flag */
#define IP_MF 0x2000                    /* more fragments flag */
        u_char  ip_ttl;                 /* time to live */
        u_char  ip_p;                   /* protocol */
        u_short ip_sum;                 /* checksum */
        struct  in_addr ip_src,ip_dst;  /* source and dest address */
};


/* this structure was taken from an RS-6000 */

/*
 * Structure of an icmp header.
 */
struct icmp {
	u_char	icmp_type;		/* type of message, see below */
	u_char	icmp_code;		/* type sub code */
	u_short	icmp_cksum;		/* ones complement cksum of struct */
	union {
		u_char ih_pptr;			/* ICMP_PARAMPROB */
		struct in_addr ih_gwaddr;	/* ICMP_REDIRECT */
		struct ih_idseq {
			n_short	icd_id;
			n_short	icd_seq;
		} ih_idseq;
		int ih_void;
	} icmp_hun;
#define	icmp_pptr	icmp_hun.ih_pptr
#define	icmp_gwaddr	icmp_hun.ih_gwaddr
#define	icmp_id		icmp_hun.ih_idseq.icd_id
#define	icmp_seq	icmp_hun.ih_idseq.icd_seq
#define	icmp_void	icmp_hun.ih_void
	union {
		struct id_ts {
			n_time its_otime;
			n_time its_rtime;
			n_time its_ttime;
		} id_ts;
		struct id_ip  {
			struct ip idi_ip;
			/* options and then 64 bits of data */
		} id_ip;
		u_long	id_mask;
		char	id_data[1];
	} icmp_dun;
#define	icmp_otime	icmp_dun.id_ts.its_otime
#define	icmp_rtime	icmp_dun.id_ts.its_rtime
#define	icmp_ttime	icmp_dun.id_ts.its_ttime
#define	icmp_ip		icmp_dun.id_ip.idi_ip
#define	icmp_mask	icmp_dun.id_mask
#define	icmp_data	icmp_dun.id_data
};
--- end cut here for file include/netinet/ip_icmp_lin.h ----------------------


--- cut here for file include/netinet/udp.h ----------------------------------
/*
 * INET		An implementation of the TCP/IP protocol suite for the LINUX
 *		operating system.  INET is implemented using the  BSD Socket
 *		interface as the means of communication with the user level.
 *
 *		Definitions for the UDP protocol.
 *
 * Version:	@(#)udp.h	1.0.2	04/28/93
 *
 * Author:	Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
 *
 *		This program is free software; you can redistribute it and/or
 *		modify it under the terms of the GNU General Public License
 *		as published by the Free Software Foundation; either version
 *		2 of the License, or (at your option) any later version.
 */
#ifndef _LINUX_UDP_H
#define _LINUX_UDP_H


/*
struct udphdr {
  unsigned short	source;
  unsigned short	dest;
  unsigned short	len;
  unsigned short	check;
};
*/

/* these are also taken from an RS-6000 */
struct udphdr {
        unsigned short uh_sport;               /* source port */
        unsigned short uh_dport;               /* destination port */
        unsigned short uh_ulen;                /* udp length */
        unsigned short uh_sum;                 /* udp checksum */
};

#endif	/* _LINUX_UDP_H */
--- end cut here for file include/netinet/udp.h ------------------------------

--
- Nils Lohner   internet: lohnen@rpi.edu   Rensselaer Polytechnic Institute 


^`'~*-,._.^`'~*-,._.^`'~*-,._.^`'~*-,._.^`'~*-,._.^`'~*-,._.^`'
                Josh Wilmes (wilmesj@rpi.edu)
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~       
"Things are more like they are now than they ever were before."
     - Dwight D. Eisenhower
^`'~*-,._.^`'~*-,._.^`'~*-,._.^`'~*-,._.^`'~*-,._.^`'~*-,._.^`'